﻿using System;
namespace WebTraderLiteCL
{
    public class GenUser : User
    {
        //initializer
        DBTransactions DB = new DBTransactions();

        public GenUser()
        {
            this.AccountStatus = "General";
            this.accBalance = 0F;
            this.AccountType = string.Empty;
            this.Email = string.Empty;
            this.FirstName = string.Empty;
            this.LastName = string.Empty;
            //this.RegistrationDate = string.Empty;
            this.UserAddress = string.Empty;
            this.zipcode = string.Empty;
            this.password = string.Empty;

        }//end default constructor

        public GenUser(string userID)
        {
            
            this.UserID = userID;
            this.AccountStatus = DB.retrieveAccountStatus(userID);
            this.AccountType = DB.retrieveAccountType(userID);
            this.accBalance = DB.retrieveAccountBal(userID);
            this.Email = DB.retrieveEmail(userID);
            this.FirstName = DB.retrieveFirstName(userID);
            this.LastName = DB.retrieveLastName(userID);
            this.RegistrationDate = DB.retrieveRegistrationDate(userID);
            this.UserAddress = DB.retrieveUserAddress(userID);
            this.zipcode = DB.retrieveZipCode(userID);
            this.password = DB.retrievePswd(userID);
            DB.CloseDB();

        }

        //return 0 on success
        private int deactivateAccount()
        {

            DB.deactivateAccount(this.UserID);
            DB.CloseDB();
            return 0;
        }//end deactiveAccount

    }//end GenUser Class
}